package Test5;

import java.util.TreeSet;

public class Test5 {
    public static void main(String[] args) {


                // 创建 TreeSet 集合
                TreeSet<Student> treeSet = new TreeSet<>();

                // 实例化 5 个 Student 对象
                Student student1 = new Student("爱迪生", 90, 55);
                Student student2 = new Student("牛顿", 100, 90);
                Student student3 = new Student("拉瓦锡", 70, 100);
                Student student4 = new Student("霍金", 100, 100);
                Student student5 = new Student("伽利略", 60, 85);
                Student student6 = new Student("达尔文", 70, 75);

                // 将对象添加到集合
                treeSet.add(student1);
                treeSet.add(student2);
                treeSet.add(student3);
                treeSet.add(student4);
                treeSet.add(student5);
                treeSet.add(student6);

                // 遍历集合打印所有元素信息
                for (Student student : treeSet) {
                    System.out.println(student);
                }
            }
        }





